package com.example.map;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zl
 * @version 1.0
 * @date 2020/4/7 8:36
 */
public class DataConvert {
    private static List<JSONObject> orgs = new ArrayList();
    public static void main(String[] args) {
        String json = "{\"Status\":true,\"StatusCode\":200,\"Data\":[{\"Department\":{\"Code\":\"5270\",\"Name\":\"上海市公安局长宁分局\",\"AreaCode\":\"310105\"},\"Children\":[{\"Department\":{\"Code\":\"5271\",\"Name\":\"局机关\",\"PCode\":\"5270\",\"AreaCode\":\"310105000000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[{\"Department\":{\"Code\":\"5272\",\"Name\":\"上海市公安局长宁分局国保处\",\"PCode\":\"5271\",\"AreaCode\":\"310105010000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[{\"Department\":{\"Code\":\"5273\",\"Name\":\"上海市公安局长宁分局国保处反邪教科\",\"PCode\":\"5272\",\"AreaCode\":\"310105010200\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]}]},{\"Department\":{\"Code\":\"5274\",\"Name\":\"上海市公安局长宁分局经侦支队\",\"PCode\":\"5271\",\"AreaCode\":\"310105020000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[{\"Department\":{\"Code\":\"5275\",\"Name\":\"上海市公安局长宁分局经侦支队情报技术室\",\"PCode\":\"5274\",\"AreaCode\":\"310105021000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5276\",\"Name\":\"上海市公安局长宁分局经侦支队金融犯罪侦查队\",\"PCode\":\"5274\",\"AreaCode\":\"310105021100\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5277\",\"Name\":\"上海市公安局长宁分局经侦支队执法监督室\",\"PCode\":\"5274\",\"AreaCode\":\"310105021200\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"7060\",\"Name\":\"上海市公安局长宁分局经侦支队食品药品环境犯罪侦查大队\",\"PCode\":\"5274\",\"AreaCode\":\"310105021300\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]}]},{\"Department\":{\"Code\":\"5278\",\"Name\":\"上海市公安局长宁分局治安支队\",\"PCode\":\"5271\",\"AreaCode\":\"310105030000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[{\"Department\":{\"Code\":\"5279\",\"Name\":\"上海市公安局长宁分局治安支队一科\",\"PCode\":\"5278\",\"AreaCode\":\"310105030300\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5280\",\"Name\":\"上海市公安局长宁分局治安支队内保科(技防办)\",\"PCode\":\"5278\",\"AreaCode\":\"310105030500\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5281\",\"Name\":\"上海市公安局长宁分局治安支队治安管理中队(行动中队)\",\"PCode\":\"5278\",\"AreaCode\":\"310105030600\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5282\",\"Name\":\"上海市公安局长宁分局治安支队巡逻指导科\",\"PCode\":\"5278\",\"AreaCode\":\"310105030700\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5283\",\"Name\":\"上海市公安局长宁分局治安支队巡逻中队\",\"PCode\":\"5278\",\"AreaCode\":\"310105030800\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5284\",\"Name\":\"上海市公安局长宁分局治安支队基层指导科\",\"PCode\":\"5278\",\"AreaCode\":\"310105031000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5285\",\"Name\":\"上海市公安局长宁分局治安支队保安管理科\",\"PCode\":\"5278\",\"AreaCode\":\"310105031200\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5286\",\"Name\":\"上海市公安局长宁分局治安支队食品药品犯罪侦查大队\",\"PCode\":\"5278\",\"AreaCode\":\"310105031600\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"6991\",\"Name\":\"上海市公安局长宁分局治安支队大型活动安全管理大队\",\"PCode\":\"5278\",\"AreaCode\":\"310105031400\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]}]},{\"Department\":{\"Code\":\"5287\",\"Name\":\"上海市公安局长宁分局刑侦支队\",\"PCode\":\"5271\",\"AreaCode\":\"310105050000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[{\"Department\":{\"Code\":\"5288\",\"Name\":\"上海市公安局长宁分局刑事科学技术研究所\",\"PCode\":\"5287\",\"AreaCode\":\"310105050200\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5289\",\"Name\":\"上海市公安局长宁分局刑侦支队一队\",\"PCode\":\"5287\",\"AreaCode\":\"310105050400\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5290\",\"Name\":\"上海市公安局长宁分局刑侦支队二队\",\"PCode\":\"5287\",\"AreaCode\":\"310105050500\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5291\",\"Name\":\"上海市公安局长宁分局刑侦支队三队\",\"PCode\":\"5287\",\"AreaCode\":\"310105050600\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5292\",\"Name\":\"上海市公安局长宁分局刑侦支队四队\",\"PCode\":\"5287\",\"AreaCode\":\"310105050700\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5293\",\"Name\":\"上海市公安局长宁分局刑侦支队五队\",\"PCode\":\"5287\",\"AreaCode\":\"310105050800\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5294\",\"Name\":\"上海市公安局长宁分局刑侦支队六队\",\"PCode\":\"5287\",\"AreaCode\":\"310105050900\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5295\",\"Name\":\"上海市公安局长宁分局刑侦支队七队\",\"PCode\":\"5287\",\"AreaCode\":\"310105051000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]}]},{\"Department\":{\"Code\":\"5296\",\"Name\":\"上海市公安局长宁分局出入境管理办公室\",\"PCode\":\"5271\",\"AreaCode\":\"310105060000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5297\",\"Name\":\"上海市公安局长宁分局网络安全保卫支队\",\"PCode\":\"5271\",\"AreaCode\":\"310105110000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5298\",\"Name\":\"上海市公安局长宁分局反恐支队\",\"PCode\":\"5271\",\"AreaCode\":\"310105120000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5299\",\"Name\":\"上海市长宁区看守所\",\"PCode\":\"5271\",\"AreaCode\":\"310105140000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5300\",\"Name\":\"上海市长宁区拘留所\",\"PCode\":\"5271\",\"AreaCode\":\"310105150000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5301\",\"Name\":\"上海市公安局长宁分局交警支队\",\"PCode\":\"5271\",\"AreaCode\":\"310105170000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[{\"Department\":{\"Code\":\"5302\",\"Name\":\"上海市公安局长宁分局交警支队综合管理大队\",\"PCode\":\"5301\",\"AreaCode\":\"310105172100\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5303\",\"Name\":\"上海市公安局长宁分局交警支队勤务路设大队\",\"PCode\":\"5301\",\"AreaCode\":\"310105172200\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5304\",\"Name\":\"上海市公安局长宁分局交警支队车管宣传大队(非机动车管理所)\",\"PCode\":\"5301\",\"AreaCode\":\"310105172300\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5305\",\"Name\":\"上海市公安局长宁分局交警支队事故审理大队\",\"PCode\":\"5301\",\"AreaCode\":\"310105172400\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5306\",\"Name\":\"上海市公安局长宁分局交警支队机动大队\",\"PCode\":\"5301\",\"AreaCode\":\"310105172500\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5307\",\"Name\":\"上海市公安局长宁分局交警支队一大队\",\"PCode\":\"5301\",\"AreaCode\":\"310105173100\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5308\",\"Name\":\"上海市公安局长宁分局交警支队二大队\",\"PCode\":\"5301\",\"AreaCode\":\"310105173200\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5309\",\"Name\":\"上海市公安局长宁分局交警支队三大队\",\"PCode\":\"5301\",\"AreaCode\":\"310105173300\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5310\",\"Name\":\"上海市公安局长宁分局交警支队四大队\",\"PCode\":\"5301\",\"AreaCode\":\"310105173400\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]}]},{\"Department\":{\"Code\":\"5311\",\"Name\":\"上海市公安局长宁分局法制支队\",\"PCode\":\"5271\",\"AreaCode\":\"310105190000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5312\",\"Name\":\"上海市公安局长宁分局警务保障处\",\"PCode\":\"5271\",\"AreaCode\":\"310105200000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[{\"Department\":{\"Code\":\"5313\",\"Name\":\"上海市公安局长宁分局警务保障处总务科\",\"PCode\":\"5312\",\"AreaCode\":\"310105200200\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5314\",\"Name\":\"上海市公安局长宁分局警务保障处装备科\",\"PCode\":\"5312\",\"AreaCode\":\"310105200400\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5315\",\"Name\":\"上海市公安局长宁分局警务保障处财务科\",\"PCode\":\"5312\",\"AreaCode\":\"310105200600\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]}]},{\"Department\":{\"Code\":\"5316\",\"Name\":\"上海市公安局长宁分局科技科\",\"PCode\":\"5271\",\"AreaCode\":\"310105220000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5317\",\"Name\":\"上海市公安局长宁分局特警支队\",\"PCode\":\"5271\",\"AreaCode\":\"310105270000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[{\"Department\":{\"Code\":\"5318\",\"Name\":\"上海市公安局长宁分局特警支队武装巡逻一中队\",\"PCode\":\"5317\",\"AreaCode\":\"310105270100\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5319\",\"Name\":\"上海市公安局长宁分局特警支队武装巡逻二中队\",\"PCode\":\"5317\",\"AreaCode\":\"310105270200\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"6992\",\"Name\":\"上海市公安局长宁分局特警支队机动中队\",\"PCode\":\"5317\",\"AreaCode\":\"310105270300\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]}]},{\"Department\":{\"Code\":\"5320\",\"Name\":\"上海市公安局长宁分局指挥处\",\"PCode\":\"5271\",\"AreaCode\":\"310105310000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[{\"Department\":{\"Code\":\"5321\",\"Name\":\"上海市公安局长宁分局指挥处秘书科\",\"PCode\":\"5320\",\"AreaCode\":\"310105310200\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5322\",\"Name\":\"上海市公安局长宁分局指挥处调研科\",\"PCode\":\"5320\",\"AreaCode\":\"310105310300\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5323\",\"Name\":\"上海市公安局长宁分局指挥处指挥中心\",\"PCode\":\"5320\",\"AreaCode\":\"310105310400\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5324\",\"Name\":\"上海市公安局长宁分局指挥处警卫科\",\"PCode\":\"5320\",\"AreaCode\":\"310105310600\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5325\",\"Name\":\"上海市公安局长宁分局指挥处信访办公室\",\"PCode\":\"5320\",\"AreaCode\":\"310105310700\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5326\",\"Name\":\"上海市公安局长宁分局指挥处情报科\",\"PCode\":\"5320\",\"AreaCode\":\"310105310800\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"6993\",\"Name\":\"上海市公安局长宁分局指挥处数据科\",\"PCode\":\"5320\",\"AreaCode\":\"310105310900\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]}]},{\"Department\":{\"Code\":\"5327\",\"Name\":\"上海市公安局长宁分局监察室\",\"PCode\":\"5271\",\"AreaCode\":\"310105320000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[{\"Department\":{\"Code\":\"5328\",\"Name\":\"上海市公安局长宁分局警务督察支队\",\"PCode\":\"5327\",\"AreaCode\":\"310105320200\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]}]},{\"Department\":{\"Code\":\"5329\",\"Name\":\"上海市公安局长宁分局政治处\",\"PCode\":\"5271\",\"AreaCode\":\"310105350000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[{\"Department\":{\"Code\":\"5330\",\"Name\":\"上海市公安局长宁分局政治处秘书科\",\"PCode\":\"5329\",\"AreaCode\":\"310105350200\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5331\",\"Name\":\"上海市公安局长宁分局政治处组织人事科\",\"PCode\":\"5329\",\"AreaCode\":\"310105350300\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5332\",\"Name\":\"上海市公安局长宁分局政治处宣传科\",\"PCode\":\"5329\",\"AreaCode\":\"310105350400\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5333\",\"Name\":\"上海市公安局长宁分局政治处教育训练科\",\"PCode\":\"5329\",\"AreaCode\":\"310105350500\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5334\",\"Name\":\"上海市公安局长宁分局政治处警务辅助人员管理科\",\"PCode\":\"5329\",\"AreaCode\":\"310105350600\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]}]},{\"Department\":{\"Code\":\"5335\",\"Name\":\"上海市公安局长宁分局人口管理办公室\",\"PCode\":\"5271\",\"AreaCode\":\"310105360000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5348\",\"Name\":\"上海市公安局长宁分局特种机动队\",\"PCode\":\"5271\",\"AreaCode\":\"310105600000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5349\",\"Name\":\"上海市公安局长宁分局保安公司\",\"PCode\":\"5271\",\"AreaCode\":\"310105980000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"6771\",\"Name\":\"上海市长宁区看守所(拘留所)\",\"PCode\":\"5271\",\"AreaCode\":\"310105130000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"6772\",\"Name\":\"法制办公室\",\"PCode\":\"5271\",\"AreaCode\":\"310105180000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]}]},{\"Department\":{\"Code\":\"5336\",\"Name\":\"上海市公安局长宁分局新虹桥治安派出所\",\"PCode\":\"5270\",\"AreaCode\":\"310105410000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5337\",\"Name\":\"上海市公安局长宁分局华阳路派出所\",\"PCode\":\"5270\",\"AreaCode\":\"310105420000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5338\",\"Name\":\"上海市公安局长宁分局天山路派出所\",\"PCode\":\"5270\",\"AreaCode\":\"310105430000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5339\",\"Name\":\"上海市公安局长宁分局江苏路派出所\",\"PCode\":\"5270\",\"AreaCode\":\"310105510000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5340\",\"Name\":\"上海市公安局长宁分局新华路派出所\",\"PCode\":\"5270\",\"AreaCode\":\"310105520000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5341\",\"Name\":\"上海市公安局长宁分局周家桥派出所\",\"PCode\":\"5270\",\"AreaCode\":\"310105530000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5342\",\"Name\":\"上海市公安局长宁分局仙霞路派出所\",\"PCode\":\"5270\",\"AreaCode\":\"310105540000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5343\",\"Name\":\"上海市公安局长宁分局虹桥路派出所\",\"PCode\":\"5270\",\"AreaCode\":\"310105550000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5344\",\"Name\":\"上海市公安局长宁分局北新泾派出所\",\"PCode\":\"5270\",\"AreaCode\":\"310105560000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5345\",\"Name\":\"上海市公安局长宁分局新泾派出所\",\"PCode\":\"5270\",\"AreaCode\":\"310105570000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5346\",\"Name\":\"上海市公安局长宁分局程家桥派出所\",\"PCode\":\"5270\",\"AreaCode\":\"310105580000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]},{\"Department\":{\"Code\":\"5347\",\"Name\":\"上海市公安局长宁分局临空经济园区治安派出所\",\"PCode\":\"5270\",\"AreaCode\":\"310105590000\",\"CreateTime\":\"2020-03-16T01:58:04.000+08:00\"},\"Children\":[]}]}]}";
        JSONObject jsonObject = JSONObject.parseObject(json);
//        jsonObject = jsonObject.getJSONObject("data");
        JSONArray data = jsonObject.getJSONArray("Data");
        addNext(data);
        print();
    }

    private static void addNext(JSONArray jsonArray) {
        jsonArray.forEach(data -> {
            JSONObject org = new JSONObject();
            org.put("Code", ((JSONObject)data).getJSONObject("Department").getString("Code"));
            org.put("Name", ((JSONObject)data).getJSONObject("Department").getString("Name"));
            org.put("AreaCode", ((JSONObject)data).getJSONObject("Department").getString("AreaCode"));
            org.put("PCode", ((JSONObject)data).getJSONObject("Department").getString("PCode"));
            orgs.add(org);
            if (((JSONObject) data).containsKey("Children")
                    && ((JSONObject) data).getJSONArray("Children") != null
                    && ((JSONObject) data).getJSONArray("Children").size() > 0) {
                addNext(((JSONObject) data).getJSONArray("Children"));
            }
        });
    }

    private static void print () {
        orgs.forEach(o -> {
            System.out.println(o.getString("Code") + "\t"
                    + o.getString("Name") + "\t"
                    + o.getString("AreaCode") + "\t"
                    + o.getString("PCode") + "\t");
        });
    }
}
